package com.cxx.purchasecharge.dal;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import com.cxx.purchasecharge.core.model.persistence.GoodsType;
import com.cxx.purchasecharge.dal.common.GenericCRUDDao;

@Transactional
public interface GoodsTypeDao extends GenericCRUDDao <GoodsType, Long>
{

    public GoodsType findById (long id);

    @Query (value = "select g from GoodsType g where g.name=?1")
    public GoodsType findByName (String name);

    @Query (value = "select g from GoodsType g where g.parent.id=?1")
    public List <GoodsType> findByParent (Long parentId);

}
